package com.stark.wechat.service.menu.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * 父菜单
 *
 * @author <a href="mengbin@eastsoft.com.cn">Ben</a>
 * @version 1.0.0
 * @since 2025/8/6
 */
@Data
@NoArgsConstructor
@RequiredArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ParentButton implements Button {

    private static final long serialVersionUID = 6903249412275703375L;

    /**
     * 菜单标题，不超过16个字节，子菜单不超过60个字节
     */
    @NonNull
    private String name;

    /**
     * 二级菜单结构体数组
     */
    @JsonProperty("sub_button")
    private List<Button> subButton = new ArrayList<>();

    /**
     * 添加二级菜单按钮
     *
     * @param button 二级菜单按钮
     * @return 当前对象
     */
    public ParentButton addSubButton(Button button) {
        this.subButton.add(button);
        return this;
    }

}
